home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
Temp.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-26
|
2KB
|
87 lines
#include <List.h>
#include <Map.h>
#include <Vector.h>
#define TEST_VECTOR 1
#define TEST_LIST 0
#define TEST_MAP 0
#if TEST_VECTOR
null_template
struct iterator_trait <long* const*> {
typedef ptrdiff_t distance_type;
typedef long* const value_type;
typedef random_access_iterator_tag iterator_category;
};
typedef vector<long*, allocator<long*> > Container;
static Container sContainer; // 8K x 5 = 40K
#endif
#if TEST_LIST
typedef list<long*, allocator<long*> > Container;
static Container sContainer; // 8K x 33 = 264K
#endif
#if TEST_MAP
typedef map<long, long*, less<long>, allocator<long*> > Container;
typedef pair<const long, long*> ContainerEntry;
static Container sContainer; // 27K x 7 = 189K
#endif
#if TEST_VECTOR || TEST_LIST
static void TestContainer()
{
long* value = nil;
Container::iterator iter = sContainer.begin();
while (iter != sContainer.end()) {
value = *iter++;
}
Container::const_iterator iter2 = sContainer.begin();
while (iter2 != sContainer.end()) {
value = *iter2++;
}
size_t size = sContainer.size();
sContainer.resize(100);
sContainer.insert(sContainer.begin(), value);
sContainer.erase(sContainer.begin());
}
#endif
#if TEST_MAP
static void TestContainer()
{
ContainerEntry entry;
Container::iterator iter = sContainer.begin();
while (iter != sContainer.end()) {
entry = *iter++;
}
Container::const_iterator iter2 = sContainer.begin();
while (iter2 != sContainer.end()) {
entry = *iter2++;
}
size_t size = sContainer.size();
sContainer.insert(sContainer.begin(), entry);
sContainer.erase(sContainer.begin());
}
#endif